package com.dongdongshop.util;

import java.io.Serializable;
import java.util.List;


public class PageBean<T> implements Serializable {
    private int startIndex;
    private int pageNum;
    private int pageSize;
    private int pages;
    private int total;
    private List<T> result;

    public PageBean() {
    }

    public PageBean(int pageNumber, int pageSize) {
        this.pageNum = pageNumber;
        this.pageSize = pageSize;
    }

    public int getStartIndex() {
        startIndex = (pageNum - 1) * pageSize;
        return startIndex;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNumber) {
        this.pageNum = pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }


    public int getPages() {
        pages = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
        return pages;
    }

    public void setPages(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getResult() {
        return result;
    }

    public void setResult(List<T> result) {
        this.result = result;
    }

}
